<link rel="stylesheet" type="text/css" href="assets/plugins/H-ui_v3.1.1/lib/icheck/icheck.css"/>
<p class="com-title">
	免费发布
</p>
<form class="site-selection-form form form-horizontal" id="freePublishForm">
	<div class="row cl">
		<label class="form-label per15">
			分类：
		</label>
		<div class="formControls per30">
			<div class="formControls per100 error-parent simulation-btn">
				<div class="radio-box">
					<input type="radio" id="areaType1" name="areaType">
					<label for="areaType1">
						<button class="btn btn-primary-outline">厂房<i class="Hui-iconfont Hui-iconfont-selected"></i></button>
					</label>
				</div>
				<div class="radio-box">
					<input type="radio" id="areaType2" name="areaType">
					<label for="areaType2">
						<button class="btn btn-primary-outline">仓库<i class="Hui-iconfont Hui-iconfont-selected"></i></button>
					</label>
				</div>
				<div class="radio-box">
					<input type="radio" id="areaType3" name="areaType">
					<label for="areaType3">
						<button class="btn btn-primary-outline">土地<i class="Hui-iconfont Hui-iconfont-selected"></i></button>
					</label>
				</div>
			</div>
		</div>
	</div>
	<div class="row cl">
		<label class="form-label per15">
			意向：
		</label>
		<div class="formControls per40">
			<div class="formControls per100 error-parent simulation-btn">
				<div class="radio-box">
					<input type="radio" id="saleType1" name="saleType">
					<label for="saleType1">
						<button class="btn btn-primary-outline">出租<i class="Hui-iconfont Hui-iconfont-selected"></i></button>
					</label>
				</div>
				<div class="radio-box">
					<input type="radio" id="saleType2" name="saleType">
					<label for="saleType2">
						<button class="btn btn-primary-outline">出售<i class="Hui-iconfont Hui-iconfont-selected"></i></button>
					</label>
				</div>
				<div class="radio-box">
					<input type="radio" id="saleType3" name="saleType">
					<label for="saleType3">
						<button class="btn btn-primary-outline">求租<i class="Hui-iconfont Hui-iconfont-selected"></i></button>
					</label>
				</div>
				<div class="radio-box">
					<input type="radio" id="saleType4" name="saleType">
					<label for="saleType4">
						<button class="btn btn-primary-outline">求购<i class="Hui-iconfont Hui-iconfont-selected"></i></button>
					</label>
				</div>
			</div>
		</div>
	</div>
	<div class="row cl">
		<label class="form-label per15">
			地区：
		</label>
		<div class="formControls per50">
			<span class="select-box f-l per30 mr-10 error-parent">
				<select class="select" name="province">
				    <option value="" selected>省</option>
				    <option value="1">A</option>
				    <option value="2">B</option>
				    <option value="3">C</option>
				</select>
			</span>
			<span class="select-box f-l per30 mr-10 error-parent">
				<select class="select" name="city">
				    <option value="" selected>市</option>
				    <option value="1">DD</option>
				    <option value="2">EE</option>
				    <option value="3">FF</option>
				</select>
			</span>
			<span class="select-box f-l per30 error-parent">
				<select class="select" name="area">
				    <option value="" selected>区</option>
				    <option value="1">GGG</option>
				    <option value="2">HHH</option>
				    <option value="3">III</option>
				</select>
			</span>
		</div>
	</div>
	<div class="row cl">
		<span class="form-label per15">
		</span>
		<div class="formControls per75">
			<button type="submit" class="btn btn-primary radius">下一步</button>
		</div>
	</div>
	
	
	<ul class="mt-50 Huialert Huialert-success">
		<li>1、一个单位请使用一个帐号，多个帐号将被封号</li>
		<li>2、禁止发布：非法信息、非同城信息、重复信息</li>
		<li>3、中介冒充非中介，信息将在第一时间内被删除</li>
		<li>4、每个帐号每天最多发布5条信息，如需发布更多信息请购买增值服务包。</li>
	</ul>
</form>

<script type="text/javascript" src="assets/plugins/H-ui_v3.1.1/lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="assets/plugins/H-ui_v3.1.1/lib/jquery.validation/jquery.validate.min.js"></script>
<script type="text/javascript" src="assets/plugins/H-ui_v3.1.1/lib/jquery.validation/additional-methods.min.js"></script>
<script type="text/javascript" src="assets/plugins/H-ui_v3.1.1/lib/jquery.validation/messages_zh.js"></script>
<script type="text/javascript">
	$(function(){
		$('.row input').iCheck({
			checkboxClass: 'icheckbox-blue',
			radioClass: 'iradio-blue',
			increaseArea: '20%'
		})
		//表单验证
		$("#freePublishForm").validate({
			rules:{
				areaType:{
					required:true
				},
				saleType:{
					required:true
				},
				province:{
					required:true
				},
				city:{
					required:true
				},
				area:{
					required:true
				}
			},
			onkeyup:false,
			submitHandler:function(form){
				var choose={};
				choose.areaType=$(".checked:nth(0)").next('label').attr('for');
				choose.areaName=$(".checked:nth(0)").next('label').find('.btn').text();
				choose.saleType=$(".checked:nth(1)").next('label').attr('for');
				choose.saleName=$(".checked:nth(1)").next('label').find('.btn').text();
				choose.province=$(".select:nth(0)").find("option:selected").text();
				choose.city=$(".select:nth(1)").find("option:selected").text();
				choose.area=$(".select:nth(2)").find("option:selected").text();
				
				if(choose.saleType=='saleType3'||choose.saleType=='saleType4'){
					//需求方表单
					location.hash="#/siteSelection";
				}else{
					//供应方表单
					chooseNextPublishPage(choose);
				}
			},
			errorPlacement:function(error,element){
				error.appendTo(element.parents('.error-parent'));
			}
		});
	});
	
	
	function chooseNextPublishPage(obj){
		var str=JSON.stringify(obj);
		location.hash="#/publishForm?param="+str;
	}
</script>